import os
from datetime import datetime

# 系统路径
system_root = os.environ.get("SystemRoot", "C:\Windows")
WUSA_PATH = os.path.join(system_root, "System32", "wusa.exe")
DISM_PATH = os.path.join(system_root, "System32", "dism.exe")
SHUTDOWN_PATH = os.path.join(system_root, "System32", "shutdown.exe")

# 版本信息
APP_VERSION = "1.2.0"
APP_NAME = "Windows补丁批量安装工具"
APP_AUTHOR = "@Evil_Pig"
APP_DESCRIPTION = "用于批量安装Windows系统补丁的工具，支持MSU、CAB和EXE格式"

# 窗口配置
MIN_WINDOW_WIDTH = 800
MIN_WINDOW_HEIGHT = 600
DEFAULT_WINDOW_WIDTH = 900
DEFAULT_WINDOW_HEIGHT = 700

# 日志配置
LOG_FORMAT = "%Y-%m-%d %H:%M:%S"
LOG_DIR_NAME = "logs"
LOG_FILE_MAX_LINES = 1000  # 界面日志最大行数

# 返回码常量
EXIT_SUCCESS = 0  # 成功
EXIT_SUCCESS_REBOOT = 3010  # 成功但需要重启
EXIT_SUCCESS_REBOOT_PENDING = 1641  # 成功但重启已排队
SUCCESS_EXIT_CODES = (EXIT_SUCCESS, EXIT_SUCCESS_REBOOT, EXIT_SUCCESS_REBOOT_PENDING)

# 文件类型
SUPPORTED_FILE_TYPES = (".msu", ".cab", ".exe")

# UI配置
PROGRESS_UPDATE_INTERVAL = 500  # 毫秒
LOG_QUEUE_PROCESS_INTERVAL = 200  # 毫秒
SASH_POSITION_DELAY = 100  # 毫秒
MINSIZE_SET_DELAY = 200  # 毫秒

# 进程超时设置（秒）
DEFAULT_PROCESS_TIMEOUT = 3600  # 默认1小时
MAX_PROCESS_OUTPUT_LINES = 10  # 每个流最多显示的行数

# 重启延迟（秒）
DEFAULT_REBOOT_DELAY = 30